package cn.dw.dg.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.dw.dg.model.User;
import cn.dw.dg.service.UserService;
import junit.framework.Test;

@Controller
@RequestMapping("/user")
public class UserController {
	@Autowired
	private UserService userService;
	
	@RequestMapping("/add")
	@ResponseBody
	public String add(User user) {
		userService.add(user);
		return "{\"result\":\"success\"}";		
	};
	
	@RequestMapping("/update")
	public String update(User user) {
		userService.update(user);
		return "success";
	};
	
	@RequestMapping("/select")
	public String  select(User user){
		userService.select(user);
		return "success";
		
	};
	
	public String delete(User user) {
		userService.delete(user);
		return "success";
		
	};
}
